package com.winit.schedule.task.tracker.runner;

import java.util.concurrent.atomic.AtomicLong;

public class StatisticsInfo {

    private long       lastFetchDataTime;

    private AtomicLong fetchDataNum      = new AtomicLong(0); // 读取次数
    private AtomicLong fetchDataCount    = new AtomicLong(0); // 读取的数据量
    private AtomicLong dealDataSucess    = new AtomicLong(0); // 处理成功的数据量
    private AtomicLong dealDataFail      = new AtomicLong(0); // 处理失败的数据量
    private AtomicLong dealSpendTime     = new AtomicLong(0); // 处理总耗时,没有做同步，可能存在一定的误差
    private AtomicLong otherCompareCount = new AtomicLong(0); // 特殊比较的次数

    public void addFetchDataNum(long value) {
        this.fetchDataNum.addAndGet(value);
    }

    public void addFetchDataCount(long value) {
        this.fetchDataCount.addAndGet(value);
    }

    public void addDealDataSucess(long value) {
        this.dealDataSucess.addAndGet(value);
    }

    public void addDealDataFail(long value) {
        this.dealDataFail.addAndGet(value);
    }

    public void addDealSpendTime(long value) {
        this.dealSpendTime.addAndGet(value);
    }

    public void addOtherCompareCount(long value) {
        this.otherCompareCount.addAndGet(value);
    }

    public long getLastFetchDataTime() {
        return lastFetchDataTime;
    }

    public void setLastFetchDataTime(long lastFetchDataTime) {
        this.lastFetchDataTime = lastFetchDataTime;
    }

    public AtomicLong getFetchDataNum() {
        return fetchDataNum;
    }

    public AtomicLong getFetchDataCount() {
        return fetchDataCount;
    }

    public AtomicLong getDealDataSucess() {
        return dealDataSucess;
    }

    public AtomicLong getDealDataFail() {
        return dealDataFail;
    }

    public AtomicLong getDealSpendTime() {
        return dealSpendTime;
    }

    public AtomicLong getOtherCompareCount() {
        return otherCompareCount;
    }

    public String getDealDescription() {
        return "FetchDataCount=" + this.fetchDataCount + ",FetchDataNum=" + this.fetchDataNum + ",DealDataSucess="
               + this.dealDataSucess + ",DealDataFail=" + this.dealDataFail + ",DealSpendTime=" + this.dealSpendTime
               + ",otherCompareCount=" + this.otherCompareCount;
    }
}
